package org.feiye.studyday25.review;

import java.io.*;

import org.feiye.studyday21.Student;

public class XuLieHua1 {
	// 单个对象序列化（把对象信息写入文件）
	public static void main(String[] args) {
		Student s = new Student("叶飞", "男");
		OutputStream f = null;
		ObjectOutputStream o = null;
		try {
			f = new FileOutputStream("F:\\叶飞io测试\\XULIEHUA.txt");
			o = new ObjectOutputStream(f);
			o.writeObject(s);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (o != null)
				try {
					o.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			if (f != null)
				try {
					f.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
		}
	}
}
